<ng-container *ngIf="ezFormControlConfiguration?.password; else searchInput">
  <nz-input-group [nzSuffix]="suffixTemplate">
    <ng-container *ngTemplateOutlet="input"></ng-container>
  </nz-input-group>
</ng-container>

<ng-template #searchInput>
  <ng-container *ngIf="ezFormControlConfiguration?.search; else input">
    <nz-input-group nzSearch [nzAddOnAfter]="suffixIconButton">
      <ng-container *ngTemplateOutlet="input"></ng-container>
    </nz-input-group>
  </ng-container>
</ng-template>

<ng-template #suffixTemplate>
  <i nz-icon [nzType]="!passwordVisible ? 'eye-invisible' : 'eye'" (click)="passwordVisible = !passwordVisible"></i>
</ng-template>

<ng-template #suffixIconButton>
  <button nz-button nzType="primary" nzSearch (click)="onSearch($event)" [disabled]="control.disabled"><i nz-icon
      nzType="search"></i></button>
</ng-template>

<ng-template #input>
  <input nz-input [type]="ezFormControlConfiguration?.password && !passwordVisible ? 'password' : 'text'"
    [placeholder]="ezFormControlConfiguration?.placeholder || ''" [formControl]="control" (focus)="onFocus($event)"
    (blur)="onBlur($event)" [readonly]="ezFormControlConfiguration.readonly"
    [maxlength]="ezFormControlConfiguration?.maxlength || defaultMaxlength" />
</ng-template>
